<?php

namespace App\Providers;

use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;

class AppServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        //
        Schema::defaultStringLength(191);
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
        //数据库调试
        DB::listen(function ($query) {
            Log::debug('执行的sql:'.$query->sql.' 参数:'.json_encode($query->bindings,JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE).' 时间:'.$query->time);
        });
    }
}
